using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace CodePlex.Resourceful.Amazon.S3
{
    public class ACLPrincipal
    {
        private readonly string _id;
        private readonly string _name;
        private readonly bool _isGroup;

        public ACLPrincipal(string id, string name, bool isGroup)
        {
            _id = id;
            _name = name;
            _isGroup = isGroup;
        }


        public override string ToString()
        {
            return string.Format("ACLPrincipal({0},{1})", this.Name, this.ID);
        }

        virtual public string ID
        {
            get
            {
                return _id;
            }
        }

        virtual public string Name
        {
            get
            {
                return _name;
            }
        }

        virtual public bool IsGroup
        {
            get
            {
                return _isGroup;
            }
        }

        public override int GetHashCode()
        {
            return _id.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            ACLPrincipal other = obj as ACLPrincipal;

            return other != null && other.GetType().Equals(this.GetType()) && other.IsGroup == this.IsGroup && other.ID == this.ID;
        }

    }
}
